<script setup>
	import {
		getCurrentInstance
	} from "vue"
	import {
		onLaunch,
		onShow,
		onHide
	} from '@dcloudio/uni-app'
	const {
		proxy
	} = getCurrentInstance()
	onLaunch(() => {		
		//是否已经Token授权
		proxy.$helper.hasAuthToken()
		
		//监听宿主App通讯数据
		uni.onNativeEventReceive((event, data) => {
			if (event == "auth_token") {
				uni.setStorageSync("token", data)
				proxy.$helper.goHome()
			}
		})
	})
	onShow(() => {
		//查看是否已授权获取宿主APP用户信息和登录状态
		if (uni.getStorageSync('loginAuth')) {
			proxy.$helper.getMPAuthToken()
		}
		
		console.log('BaseMp Show')
	})
	onHide(() => {
		console.log('BaseMp Hide')
	})
</script>

<style>
	/*每个页面公共css */
</style>